<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>SemOpt: src/OrClause.cpp Source File</title>

<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>


</head>
<body>
<div id="top"><!-- do not remove this div! -->


<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  
  
  <td style="padding-left: 0.5em;">
   <div id="projectname">SemOpt
   &#160;<span id="projectnumber">0.2alpha5-SCC</span>
   </div>
   
  </td>
  
  
  
 </tr>
 </tbody>
</table>
</div>

<!-- Generated by Doxygen 1.7.6.1 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>File&#160;Members</span></a></li>
    </ul>
  </div>
</div>
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
  initNavTree('OrClause_8cpp.html','');
</script>
<div id="doc-content">
<div class="header">
  <div class="headertitle">
<div class="title">src/OrClause.cpp</div>  </div>
</div><!--header-->
<div class="contents">
<a href="OrClause_8cpp.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 
<a name="l00011"></a>00011 <span class="preprocessor">#include &quot;OrClause.h&quot;</span>
<a name="l00012"></a>00012 
<a name="l00018"></a><a class="code" href="classOrClause.html#a4631acd310d445535a08e84d51c84f6e">00018</a> <a class="code" href="classOrClause.html#a4631acd310d445535a08e84d51c84f6e" title="Simple constructor.">OrClause::OrClause</a>()
<a name="l00019"></a>00019 {
<a name="l00020"></a>00020         this-&gt;clause = vector&lt;Variable&gt;();
<a name="l00021"></a>00021 }
<a name="l00022"></a>00022 
<a name="l00029"></a><a class="code" href="classOrClause.html#ae85000bdcd5e0c96cb5369cf4d59240e">00029</a> <a class="code" href="classOrClause.html#a4631acd310d445535a08e84d51c84f6e" title="Simple constructor.">OrClause::OrClause</a>(<span class="keywordtype">int</span> count, ...)
<a name="l00030"></a>00030 {
<a name="l00031"></a>00031         va_list ap;
<a name="l00032"></a>00032         va_start(ap, count);
<a name="l00033"></a>00033         this-&gt;clause = vector&lt;Variable&gt;();
<a name="l00034"></a>00034         <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i &lt; count; i++)
<a name="l00035"></a>00035         {
<a name="l00036"></a>00036                 this-&gt;clause.push_back(va_arg(ap, <a class="code" href="classVariable.html" title="`Variable` is defined easily as a `typedef int Variable`">Variable</a>));
<a name="l00037"></a>00037         }
<a name="l00038"></a>00038         va_end(ap);
<a name="l00039"></a>00039 }
<a name="l00040"></a>00040 
<a name="l00046"></a><a class="code" href="classOrClause.html#a09a95fb8ce2a1d10ae7c22295265725c">00046</a> <span class="keywordtype">void</span> <a class="code" href="classOrClause.html#a09a95fb8ce2a1d10ae7c22295265725c" title="Method for adding a variable at the end of the clause.">OrClause::appendVariable</a>(<a class="code" href="classVariable.html" title="`Variable` is defined easily as a `typedef int Variable`">Variable</a> x)
<a name="l00047"></a>00047 {
<a name="l00048"></a>00048         (this-&gt;clause).push_back(x);
<a name="l00049"></a>00049 }
<a name="l00050"></a>00050 
<a name="l00056"></a><a class="code" href="classOrClause.html#a3ad02fa758db9d8b4a432e4c5ee7638e">00056</a> <span class="keywordtype">void</span> <a class="code" href="classOrClause.html#a3ad02fa758db9d8b4a432e4c5ee7638e" title="Method for adding a variable at the beginning of the clause.">OrClause::addHeadVariable</a>(<a class="code" href="classVariable.html" title="`Variable` is defined easily as a `typedef int Variable`">Variable</a> x)
<a name="l00057"></a>00057 {
<a name="l00058"></a>00058         this-&gt;clause.insert(this-&gt;clause.begin(), x);
<a name="l00059"></a>00059 }
<a name="l00060"></a>00060 
<a name="l00068"></a><a class="code" href="classOrClause.html#a4602e98acda51523bf55cc2ca1d59ad6">00068</a> <span class="keywordtype">void</span> <a class="code" href="classOrClause.html#a4602e98acda51523bf55cc2ca1d59ad6" title="Method for returning a string representation of the Or clause in a `stringstream` object...">OrClause::toSS</a>(stringstream *ss)<span class="keyword"> const</span>
<a name="l00069"></a>00069 <span class="keyword"></span>{
<a name="l00070"></a>00070         <span class="keywordflow">if</span> ((<span class="keywordtype">int</span>) this-&gt;clause.size() != 0)
<a name="l00071"></a>00071         {
<a name="l00072"></a>00072                 <span class="keywordtype">string</span> sep = <span class="stringliteral">&quot; &quot;</span>;
<a name="l00073"></a>00073                 <span class="keywordtype">string</span> endcl = <span class="stringliteral">&quot;0&quot;</span>;
<a name="l00074"></a>00074                 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i &lt; (int) this-&gt;clause.size(); i++)
<a name="l00075"></a>00075                         (*ss) &lt;&lt; this-&gt;clause.at(i) &lt;&lt; sep;
<a name="l00076"></a>00076                 (*ss) &lt;&lt; endcl;
<a name="l00077"></a>00077         }
<a name="l00078"></a>00078 }
<a name="l00079"></a>00079 
<a name="l00087"></a><a class="code" href="classOrClause.html#ae8edb2f491a3b4f5d8bd402ef1788d82">00087</a> <span class="keywordtype">void</span> <a class="code" href="classOrClause.html#ae8edb2f491a3b4f5d8bd402ef1788d82" title="Method for cloning this OrClause into a new OrClause that is passed as input output parameter...">OrClause::clone</a>(<a class="code" href="classOrClause.html" title="Class encompassing a list of SAT variables (type `Variable`) linked by or operators.">OrClause</a> *newclause)
<a name="l00088"></a>00088 {
<a name="l00089"></a>00089         (*newclause) = <a class="code" href="classOrClause.html#a4631acd310d445535a08e84d51c84f6e" title="Simple constructor.">OrClause</a>();
<a name="l00090"></a>00090         <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i &lt; (int) this-&gt;clause.size(); i++)
<a name="l00091"></a>00091                 (*newclause).appendVariable(this-&gt;clause.at(i));
<a name="l00092"></a>00092 }
<a name="l00093"></a>00093 
<a name="l00094"></a>00094 ostream&amp; <a class="code" href="Argument_8cpp.html#a76ef732a0021f3ac6698582cf94a079e">operator&lt;&lt;</a>(ostream&amp; out, <span class="keyword">const</span> <a class="code" href="classOrClause.html" title="Class encompassing a list of SAT variables (type `Variable`) linked by or operators.">OrClause</a>&amp; r)
<a name="l00095"></a>00095 {
<a name="l00096"></a>00096         stringstream ss(stringstream::in | stringstream::out);
<a name="l00097"></a>00097         r.<a class="code" href="classOrClause.html#a4602e98acda51523bf55cc2ca1d59ad6" title="Method for returning a string representation of the Or clause in a `stringstream` object...">toSS</a>(&amp;ss);
<a name="l00098"></a>00098         out &lt;&lt; ss.str();
<a name="l00099"></a>00099         <span class="keywordflow">return</span> out;
<a name="l00100"></a>00100 }
<a name="l00101"></a>00101 
<a name="l00102"></a>00102 OrClause::~OrClause()
<a name="l00103"></a>00103 {
<a name="l00104"></a>00104 }
<a name="l00105"></a>00105 
</pre></div></div><!-- contents -->
</div>
  <div id="nav-path" class="navpath">
    <ul>
      <li class="navelem"><a class="el" href="OrClause_8cpp.html">OrClause.cpp</a>      </li>

    <li class="footer">Generated on Fri Jan 17 2014 11:47:51 for SemOpt by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.6.1 </li>
   </ul>
 </div>


</body>
</html>
